import {Module} from '@nestjs/common';
import {AppController} from './app.controller';
import {AppService} from './app.service';
import {TypeOrmModule} from '@nestjs/typeorm';
import {UsersModule} from './users/users.module';
import {UsersController} from './users/users.controller';
import {UsersService} from './users/users.service'
import config from '../config'

import {User} from './users/user.entity';
import { AuthModule } from './auth/auth.module';
import { BookmarkModule } from './bookmark/bookmark.module';
import {Bookmark, BookmarkTagsHoard} from "./bookmark/bookmark.entity";
import {Category} from "./bookmark/category/category.entity";

const {host, username, password, database} = config
const mySqlModule = TypeOrmModule.forRoot({
    type: 'mysql',
    host,
    port: 3306,
    username,
    password,
    database,
    entities: [User,Bookmark,Category,BookmarkTagsHoard],
    synchronize: true,
})

@Module({
    imports: [mySqlModule, UsersModule, AuthModule, BookmarkModule],
    exports: [TypeOrmModule],
    providers: [AppService],
    controllers: [AppController],
})

export class AppModule {
}
